package com.ghh.app.monsterrush.weapons;

import java.util.ArrayList;
import java.util.List;

import com.ghh.app.monsterrush.AbstractFactory;
import com.ghh.app.monsterrush.MonsterRushGame;
import com.ghh.app.monsterrush.WeaponActor;

public class WeaponFactory extends AbstractFactory<WeaponActor> {
	private MonsterRushGame				game;

	private static final List<Weight>	wl	= new ArrayList<Weight>();
	static {
		wl.add(new Weight("bomb", 1));
		wl.add(new Weight("shuriken", 5));
		wl.add(new Weight("pepper", 3));
	}

	public WeaponFactory(MonsterRushGame game) {
		super(wl);
		this.game = game;
	}

	@Override
	protected WeaponActor create(String name) {
		if ("bomb".equals(name)) {
			return new Bomb(game);
		}
		if ("shuriken".equals(name)) {
			return new Shuriken(game);
		}
		if ("pepper".equals(name)) {
			return new Pepper(game);
		}
		throw new IllegalArgumentException("can not find the WeaponActor by name " + name);
	}

}
